Skip to content

fix(agent-tools): remove read freshness gating - #2886

Merged
wsp1911 merged 1 commit into
GCWing:mainfrom
wsp1911:rm-read-freshness
Sep 8, 2026
Merged

fix(agent-tools): remove read freshness gating#2886
wsp1911 merged 1 commit into
GCWing:mainfrom
wsp1911:rm-read-freshness

Conversation

@wsp1911

@wsp1911 wsp1911 commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Remove session-scoped Read freshness checks from Edit and Write,
including state recording, mutation backfills, and obsolete contracts.
Keep prompt guidance requiring agents to read files before editing.

The gate cannot correct an inaccurate old_string. It adds rejection
conditions beyond content matching: changes outside the target block
can invalidate an otherwise applicable edit, while rollback or context
replacement clears cached reads. Since the state is memory-only,
restarting also loses Read records even when the restored conversation
still contains the relevant file content.

This follows established approaches in Codex and OpenCode:

  • Codex apply_patch reads current file content and matches patch context
    without requiring session-scoped prior-Read credentials.
  • OpenCode previously tracked read timestamps, mtime, and size per
    session and path, rejecting edits and overwrites without a prior Read
    or after metadata changes. Commit 76a141090, "chore: delete filetime
    module (#22999)", removed that module, its Read/Edit/Write integration,
    the disable-check flag, and associated tests.
  • Current OpenCode edit and apply_patch match against current content;
    write likewise has no runtime prior-Read gate.

Preserve Deep Review range receipts in a separate store, including
their session cleanup behavior. Improve old_string mismatch errors
to mention external changes or incorrectly copied or generated text,
retain nearby-content diagnostics, and direct agents to Read the
current target region before correcting the edit and retrying.

@wsp1911 wsp1911 changed the title rm read freshness fix(agent-tools): remove read freshness gating Sep 8, 2026
Remove session-scoped Read freshness checks from Edit and Write,
including state recording, mutation backfills, and obsolete contracts.
Keep prompt guidance requiring agents to read files before editing.

The gate cannot correct an inaccurate old_string. It adds rejection
conditions beyond content matching: changes outside the target block
can invalidate an otherwise applicable edit, while rollback or context
replacement clears cached reads. Since the state is memory-only,
restarting also loses Read records even when the restored conversation
still contains the relevant file content.

This follows established approaches in Codex and OpenCode:
- Codex apply_patch reads current file content and matches patch context
  without requiring session-scoped prior-Read credentials.
- OpenCode previously tracked read timestamps, mtime, and size per
  session and path, rejecting edits and overwrites without a prior Read
  or after metadata changes. Commit 76a141090, "chore: delete filetime
  module (#22999)", removed that module, its Read/Edit/Write integration,
  the disable-check flag, and associated tests.
- Current OpenCode edit and apply_patch match against current content;
  write likewise has no runtime prior-Read gate.

Preserve Deep Review range receipts in a separate store, including
their session cleanup behavior. Improve old_string mismatch errors
to mention external changes or incorrectly copied or generated text,
retain nearby-content diagnostics, and direct agents to Read the
current target region before correcting the edit and retrying.
@wsp1911
wsp1911 merged commit 73afe4e into GCWing:main Sep 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant